define(["jquery","cookie","template"],function($,cookie,template){	
	return $.get("/html/include/header.html",function(data){
		$("header").html(data);
		//鼠标滑过prod  f_page 时出现 f_page 划出时f_page消失
		$(".prod").hover(function(){
			$(".f_page").show();
		},function(){
			$(".f_page").hide();
		});
		$(".f_page").hover(function(){
			$(".f_page").show();
		},function(){
			$(".f_page").hide();
		});
		$(".txt").keyup(function(e){
			const word = $(this).val();
			let html = "";	
			$.getJSON(`https://suggest.taobao.com/sug?code=utf-8&q=${word}&_ksTS=1533993270276_509&callback=?`,function(data){
				data.result.forEach(function(curr){
					html += `<div>${curr[0]}</div>`;
				});
				$(".search").append("<div class = 'suggest'></div>")
				$(".suggest").html(html);
				$(".suggest").on("click","div",function(){
					$(".txt").val($(this).html());
					$(".suggest").hide();
				});
				if(word === "")
				$(".suggest").hide();
			});
		});
		$.cookie.json = true;
		const loginUser = $.cookie("login_user");
		if(loginUser){
			$(".welcome").html(`欢迎您：<span style="color:red">${loginUser}</span>，<a href="javascript:void(0);" class="logout" style="color:#969696">注销</a> <a href="/html/register.html" target="_self">免费注册</a>`);
		}
		$(".logout").click(function(){
			$.removeCookie("login_user",{path:"/"});
			location.reload();
		})
	}).done(function(){
		$.getJSON("http://rap2api.taobao.org/app/mock/25375/products",function(data){
			const html = template("h_temp",{list:data.res_body.data});
			$(".f_page").html(html);
		})
	})
});





			